<?php

namespace App\Http\Requests\Api;

class CompanyCertificationRequest extends ApiRequest
{
    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        $id='';
        if ($this->is('*/update')) {//更新时id必须
            $id='bail|required|integer';
        }

        return [
            'id' =>  $id,
            'company_name' => 'required',
            'file' => 'bail|required|image|mimes:jpeg,bmp,png|max:' . (strval(1024 * 3)),//不能超过3M
        ];
    }

    public function attributes()
    {
        return [
            'company_name' => '公司名称',
            'file' => '营业执照图片',
        ];
    }

    public function messages()
    {
        return array_merge(parent::messages(),[
            'file.max'=>':attribute图片不能超过3M',
        ]);
    }
}
